﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BAL;
namespace blog.Posts
{
    public partial class WritePost :blog.Class.PageBase
    //public partial class WritePost:System.Web.UI.Page
    {
        protected  void Page_Load(object sender, EventArgs e)
        {
           // base.Initialize();
            //Alert(this.Page,(username + password));
        }

     

        protected void submitpost_Click(object sender, EventArgs e)
        {
            DateTime time = DateTime.Now;
            string strnowtime = time.ToString();
            string strpostname=this.postname.Text.ToString();
            string strpostcontant=this.postcontent.Text.ToString();
            //string strusername="test";
            string strusername = this.username;
            if (BAL.DoPost.insertpost(strpostname, strpostcontant, strnowtime, strusername))
            {
                //Alert(this.Page,"提交成功!");
                string msg = "提交成功";
                Alert(msg);
                Response.Redirect("~/index.aspx");
            }
            else
            {
                Alert(this.Page,"提交失败!");

            }
            
        }
    }
}